package com.waghost.bridalgown.controller;

import com.waghost.bridalgown.annotaion.Logging;
import com.waghost.bridalgown.entity.Banner;
import com.waghost.bridalgown.entity.Comm;
import com.waghost.bridalgown.entity.Result;
import com.waghost.bridalgown.service.BannerService;
import com.waghost.bridalgown.service.CommService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

// 评论
@RestController
@CrossOrigin
@AllArgsConstructor
@RequestMapping("/comm")
public class CommController {

    private CommService commService;

    @GetMapping("/list")
    public Result list() {
        return commService.list();
    }

    // 根据婚纱查评论
    @GetMapping("/get/{id}")
    public Result get(@PathVariable("id") Integer id) {
        return commService.getId(id);
    }

    @PostMapping("/add")
    public Result addUser(@RequestBody Comm comm) {
        return commService.add(comm);
    }

    @PostMapping("/edit")
    public Result editUser(@RequestBody Comm comm) {
        return commService.update(comm);
    }

    @PostMapping("/del/{id}")
    public Result delUser(@PathVariable("id") Integer id) {
        return commService.delete(id);
    }


}
